//
//  Camera.cpp
//  GL_test_cpp
//
//  Created by Garrett Manka on 9/18/11.
//  Copyright 2011. All rights reserved.
//

#include <graphics/Camera.h>
#include <sim/Player.h>
#include <iostream>

namespace Sim
{
    
    Camera::Camera():Player()
    {
    }
    
    Camera::Camera(const std::string& name, Vector pos, Vector vel, Vector up): Player(name,pos,vel,up)
    {
    }
    
    Camera::Camera(Vector& pos, Vector& vel, Vector& accel, Vector& up): Player(pos,vel,accel,up)
    {
    }
    
    void Camera::orient(Player *player)
    {
        Vector pos = getPosition();
        
        setPosition( ( m_pos_offset + player->getPosition() ) - 2.0 * player->getView());
        m_focus = player->getPosition();
        setUp(player->getUp());
    }
    
    void Camera::moveDown()
    {
        m_pos_offset = m_pos_offset - getUp();
    }
    
    void Camera::moveUp()
    {
        m_pos_offset = m_pos_offset + getUp();
    }
    
    const Vector& Camera::getFocus() const
    {
        return m_focus;
    }

}